//
//  EmptyView.swift
//  Automobile
//
//  Created by erkebulan elzhan on 8/10/20.
//  Copyright © 2020 erkebulan elzhan. All rights reserved.
//

import UIKit
import SnapKit


final class EmptyView: UIView {
    
    private lazy var titleLbl: UILabel = {
        let lbl = UILabel()
        lbl.sizeToFit()
        lbl.font = UIFont.systemFont(ofSize: 20, weight: .bold)
        lbl.textAlignment = .center
        lbl.textColor = .darkBlueColor
        return lbl
    }()
    
    private lazy var iconView: UIImageView = {
        let imageView = UIImageView()
        imageView.image = UIImage(named: "emptyCar")
        imageView.contentMode = .scaleAspectFit
        return imageView
    }()
    
    init () {
        super.init (frame: .zero)
        self.addView()
        titleLbl.text = "Ничего не найдено"
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func addView () {
        self.addSubview(titleLbl)
        self.addSubview(iconView)
        
        iconView.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview()
            make.top.equalToSuperview().offset(20)
            make.width.equalTo(160)
            make.height.equalTo(114)
        }
        
        titleLbl.snp.makeConstraints { (make) in
            make.leading.trailing.equalToSuperview()
            make.top.equalTo(iconView.snp.bottom).offset(20)
        }
    }
    
}
